var a;
require("../util.js");
require("../component/components.js");
require("../../jsMt/util.js");
var userInfo=JSON.parse(sessionStorage.getItem("userInfo"));
var vm = new Vue({
    el:"#collageOK",
    data:{
        isShare:false,
        loginUid:"",
        userInfo:{},
        isScreen:"",
        list:{},
        orderNumber:"",
        burstList:{}
    },
    mounted:function(){
        this.searchObject = this.getQueryStringArgs();
        this.orderNumber=this.searchObject&&this.searchObject.orderNumber;
        // if(this.searchObject&&this.searchObject.loginUid){
        //     this.loginUid=this.searchObject&&this.searchObject.loginUid;
        // }else{
        //     if(!userInfo){
        //         location.href="/loginIndex"
        //     }else{
        //         this.userInfo=userInfo;
        //         this.loginUid=userInfo.id;
        //     }
        // }
        this.getCouponByCouponId();
    },
    methods:{
        //后退
        getBack: function () {
            history.go(-1);
        },
        bgimg:function(url){
            url = url?url:"";
            return {
                "background-image":'url("'+url+'"),url("")'
            }
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        //乐购-订单详情
        getCouponByCouponId:function(){
            var that=this,data;
            data={
                orderNumber:that.orderNumber
            };
            this.ajax({url:"/purchase/getCollageByOrderNumber",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0&&b.json.data){
                    that.burstList=b.json.data;
                    that.list=that.burstList.list;
                }else{
                    vm.$refs.prompt.toast("获取详情失败！")
                }
            });
        },
        //跳转页面
        getNext:function(type){
            if(type==1){
                location.href="/purchase/goodsDetails?productId="+this.burstList.productId+"&type=1"
            }else if(type==2){
                location.href="/enjoy"
            }
        }
    }
});
function checkTime(i){ //将0-9的数字前面加上0，例1变为01
    if(i<10){
        i = "0" + i;
    }
    return i;
}